PROJET=presentation

LATEX=latex
LATEXFLAGS=-file-line-error -halt-on-error -interaction errorstopmode
GLOSSTEX=glosstex
MAKEINDEX=makeindex

GDF=glossaire.gdf

READER=xpdf #-fullscreen
CFIG=fig2dev

IMGSRC=$(wildcard ./fig/src/*.fig)
IMAGES_tex=$(shell grep -E -h -o 'fig/.*\.(pdf_t)' $(PROJET).tex)
IMAGES_pdf=$(patsubst %.pdf_t,%.pdf,$(IMAGES_tex))
SRC=$(wildcard ./*.tex)

$(PROJET).pdf:$(SRC) $(IMAGES_pdf) $(IMAGES_tex) $(SRC) $(IMGSRC) $(PROJET).tex
	$(LATEX) $(LATEXFLAGS) $(PROJET).tex
	$(LATEX) $(LATEXFLAGS) $(PROJET).tex > /dev/null #Pour le TOC
	dvips $(PROJET).dvi
	ps2pdf $(PROJET).ps
	rm $(PROJET).dvi

.PHONY:run
run: $(PROJET).pdf
	$(READER) $(PROJET).pdf &

.PHONY:check
check:
	aspell --lang=fr_FR --encoding=UTF-8 -c $(PROJET).tex

.PHONY:cleangraph
cleangraph:
	rm -f fig/*.pdf fig/*.pdf_t
		    
.PHONY:clean
clean: cleangraph
	rm -f *.aux *.log *.toc *.lof *.glo *.ist *.ind *.gxs *.gxg *.ilg *.glx *.idx *.out *snm *nav

.PHONY:mrproper
mrproper:clean cleangraph
	[ -f $(PROJET).pdf ] && rm $(PROJET).pdf
